<%@page import="com.naszetatry.controller.RegistrationController"%>
<%@page import="com.naszetatry.constans.Message"%>
<%@page import="com.naszetatry.beans.User"%>
<%@page import="com.naszetatry.registration.RValidation"%>
<%@ include file= "/html/header.html" %>

<div id="main">

	<% 
	   User user = RegistrationController.getUser(request);
	   RValidation rValidation = RegistrationController.getValidation(request);
	%>
	
	<noscript>Masz wylaczony JavaScritp.</noscript>
	<form id = "form" action="registration" onsubmit="return validate(); ">
    	<table>   
    		<tr>
    			<td>
       				login:
       			</td>
       			<td>
       				<input type="text" name="login" value=<%= user.getLogin() %>>
       			</td>
       			<td>	 
       				<div id ="login" class = "validation">
				       	<% if(!rValidation.isLoginValid) out.println(Message.INVALID_LOGIN);
				       		else if(!rValidation.isLoginUnused) out.println(Message.USED_LOGIN);
					  	 %>
				  	 </div>
				</td>
	   		</tr>
	   		
			<tr>
				<td>
					haslo: 
				</td>
				<td>
					<input type="password" name="password1" onkeyup="passwordStrength(this.value)">
				</td>	
				<td>
					<div id="passwordStrength" class="strength0"></div>
				</td>
			</tr>
			
			<tr>
				<td>
					powtorz haslo: 
				</td>
				<td>
					<input type="password" name="password2"> 
				</td>
				<td>
					<div id = "password" class = "validation">
						 <% if(!rValidation.isPasswordMatch) out.println(Message.NOMATCH_PASSWORD + "<br>");
		   	  				else if(!rValidation.isPasswordValid) out.println(Message.INVALID_PASSWORD + "<br>");
		   				%>
	   				</div>
				</td>
			</tr>
			
			<tr>
				<td>
					mail:  
				</td>
				<td>
					<input type="text" name="mail" value= <%= user.getMail() %>> 
				</td>
				<td>
					<div id = "mail" class = "validation">
						 <% if(!rValidation.isMailValid) out.println(Message.INVALID_MAIL); 
	       	  				else if(!rValidation.isMailUnused) out.println(Message.USED_MAIL);  
						 %>
					 </div>
				</td>
			</tr>
			
			<tr>
				<td>
					<input type="checkbox" name = "regulation" >  
				</td>
				<td>
					regulamin
				</td>
				<td>
					<div id = "regulation" class = "validation">
						 <% if(!rValidation.isRegulationAccepted) out.println(Message.NOTACCEPTED_REGULATION);
						 %>
					 </div>
				</td>
			</tr>
		</table>
			
	  
       
       
       
       
       
       <input type="submit" value="zarejestruj sie">
    </form>
</div>

<%@ include file= "right.jsp" %>

<%@ include file= "/html/footer.html" %>
